<template>
	<view class="whole">
		<scroll-view scrollY class="whole-scroll" @scrolltolower="reachBottom">
			<view class="whole-item">
				<view class="" class="whole-item-item" v-for="(item, index) in songlist" :key="index" @tap="send(item.id)">
					<image :src="item.coverImgUrl" mode=""></image>
					<view class="whole-item-item-title">
						<text>{{item.name}}</text>
						<view style="font-size:15rpx;color: #6D6D6D;">
							<text>{{item.trackCount}}首,by{{item.creator.nickname}},播放{{item.playCount | count }}</text>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		props: ['songlist'],
		methods: {
			// 触底就调用方法
			reachBottom() {
				this.$parent.$parent.$parent.$parent._getmylist()
			},
			
			//点击跳转到歌单详情
			send(id){
				uni.navigateTo({
					url:'/view/SongSheet/SongSheet?id=' + id
				})
			}
			
		},
		filters: {
			count(v) {
				return v > 10000 ? (v / 10000).toFixed(1) + '万次' : v + '次'
			}
		}
	}
</script>

<style lang="scss" scoped>
	.whole {
		&-scroll {
			height: calc(100vh - 84px);
		}

		&-item {
			display: flex;
			flex-direction: column;
			background-color: #f6f6f6;
			// padding: 30rpx 0 0 0;
			box-sizing: border-box;
			border-bottom: 1px solid #E5E5E5;
			// margin: 0 15px;

			

			&-item {
				padding: 10rpx 30rpx;
				background-color: #fff;
				display: flex;

				image {
					width: 100rpx;
					height: 100rpx;
					border-radius: 10px;
				}

				&-title {
					display: flex;
					flex-direction: column;
					margin-left: 20rpx;
					font-size: 30rpx;
					justify-content: center;
				}
			}
		}
	}
</style>
